package view.Interface.button;

import javax.swing.*;

public class CustomButton extends JPanel {

    private JButton button;

    public CustomButton(String text) {
        button = new JButton(text);
        add(button);
    }

    public void setOnClickListener(ClickEventHandler handler) {
        button.addActionListener(e -> handler.onClick());
    }

    public void setOnHoverHandler(HoverEventHandler handler) {
        button.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent e) {
                handler.onHover();
            }
        });
    }
}